package com.zlz.open.ugs.exception;

import com.zlz.open.ugs.common.config.exception.ExceptionEntity;

/**
 * @Author: zhulinzhong
 * @Date: 2024/5/25
 */
public class ExceptionHandler {

    public static ExceptionEntity handle(Throwable e) {
        if (e instanceof UGSException) {
            return ExceptionEntity.builder()
                    .code(((UGSException) e).getCode())
                    .msg(e.getMessage()).build();
        }
        return ExceptionEntity.builder().msg(e.getMessage()).build();
    }
}
